#!/bin/sh
i=1
while [ $i -le $1 ]
do
	GROUPNAME=upc${i}
	groupadd $GROUPNAME
	j=1
	while [ $j -le $2 ]
	do
		if [ $j -le 9 ]
		then 
			USERNAME=${GROUPNAME}cc0${j}
		else
			USERNAME=${GROUPNAME}cc${j}
		fi
		#echo $GROUPNAME
		useradd -g $GROUPNAME -s /bin/csh $USERNAME
		if [ ! -d /home/${USERNAME} ]
		then
			mkdir /home/$USERNAME
		fi
		chown -R ${USERNAME} /home/$USERNAME
		chgrp -R ${GROUPNAME} /home/$USERNAME
		j=$(($j+1))
	done
	i=$(($i+1))
done
